import { Column, Entity, PrimaryGeneratedColumn, BaseEntity, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from 'typeorm';
@Entity('erp_purchase')
export class Purchase extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number;
    @Column()
    code: string;
    @Column('int')
    supplierId: number;
    @Column('tinyint')
    applyStatus: number;
    @Column('tinyint')
    status: number;
    @DeleteDateColumn({ nullable: true }) // TypeORM 内置软删除字段
    deletedTime: Date;
    @Column('int')
    applyAdminId: number;
    @Column('int')
    createAdminId: number;
    @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
    createTime: Date;
    @UpdateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
    updateTime: Date;
}


@Entity('erp_purchase_goods')
export class PurchaseGoods extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number;
    @Column('int')
    purchaseId: number;
    @Column('int')
    goodsId: number;
    @Column('decimal', { precision: 10, scale: 2 })
    quantity: number;
    @Column('decimal', { precision: 10, scale: 2 })
    unitCost: number;
    @Column('decimal', { precision: 10, scale: 2 })
    totalCost: number;
}